﻿
using B.S.InOut.Domain;
using B.S.InOutErrorCode;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.S.InOut.Data.OutManage
{
    public interface IOutManageRepository
    {
        // 插入产品的异步方法
        Task<int> InsertOutMenageAsync(Outmanagement product);
        // 根据 ID 获取产品的异步方法
        Task<Outmanagement> GetOutMenageByIdAsync(int id);
        // 获取所有产品的异步方法
        Task<IEnumerable<Outmanagement>> GetAllOutMenageAsync();
        // 更新产品的异步方法
        Task<int> UpdateOutMenageAsync(Outmanagement product);
        // 根据 ID 删除产品的异步方法
        Task<int> DeleteOutMenageAsync(int id);
        /// <summary>
        /// 多条件分页查询产品
        /// </summary>
        /// <param name="name">产品名称（可空，作为查询条件）</param>
        /// <param name="minPrice">最低价格（可空，作为查询条件）</param>
        /// <param name="maxPrice">最高价格（可空，作为查询条件）</param>
        /// <param name="pageNumber">页码</param>
        /// <param name="pageSize">每页显示的记录数</param>
        /// <returns>分页后的产品列表</returns>
        Task<IEnumerable<Outmanagement>> GetOutMenageByConditionsAsync(string? Outboundnumber, int? Outbound, int? OutAuditstatus, int pageindex, int pageSize);

        /// <summary>
        /// 批量删除产品
        /// </summary>
        /// <param name="productIds">要删除的产品 ID 列表</param>
        /// <returns>受影响的行数</returns>
        Task<int> DeleteOutMenageAsyncd(IEnumerable<int> productIds);
        /// <summary>
        /// 联合查询 Outmanagement 和 ProductModel 表
        /// </summary>
        /// <returns>联合查询结果的列表</returns>
        Task<IEnumerable<OutmanagementProduct>> GetOutmanagementWithProductModelAsync(string? Outboundnumber, ApiOutbound? Outbound, ApiStatus? OutAuditstatus, int pageindex, int pageSize);
        /// <summary>
        /// 根据出库 ID 查询 Outmanagement 和 ProductModel 两表关联数据
        /// </summary>
        /// <param name="outmanagementId">出库 ID</param>
        /// <returns>查询到的 OutmanagementProductModel 对象，如果未找到则返回 null</returns>
        Task<OutmanagementProduct> GetOutmanagementAndProductModelByIdAsync(int Id);

        /// <summary>
        /// 批量删除产品
        /// </summary>
        /// <param name="productIds">要删除的产品 ID 列表</param>
        /// <returns>受影响的行数</returns>
        Task<int> GetOutMenageAsyncdIds(IEnumerable<int> productIds);


        /// <summary>
        /// 根据编号查询出库单
        /// </summary>
        /// <param name="outboundnumbers"></param>
        /// <returns></returns>
        Task<IEnumerable<Outmanagement>> GetOutmanagementByOutboundNumberAsync(string outboundNumber);

    }
}
